package com.forekonw.demo6;

import java.util.Scanner;

public class TestGame {
    public static void main(String[] args) {
        System.out.println("-------------欢迎进入游戏世界-------------");
        System.out.println("*****************************************");
        System.out.println("********     猜拳 游戏 开始咯     ********");
        System.out.println("出拳规则：1.剪刀 2.石头 3.布");
        System.out.println("请选择对方角色（1：刘备 2.孙权 3.曹操）");
        Person p = new Person();
        Computer c = new Computer();
        Game g = new Game();
        Scanner input = new Scanner(System.in);
        int player = input.nextInt();
        System.out.println("请输入你的姓名:");
        String na = input.next();
        p.setName(na);
        switch (player){
            case 1:
                c.setName("刘备");
                break;
            case 2:
                c.setName("孙权");
                break;
            case 3:
                c.setName("曹操");
                break;
        }
        System.out.println(p.getName() +"   VS   "+c.getName()+"      对战");

        System.out.println("要开始吗？（y/n）");
        String star = input.next();
        int cs = 0;
        while (star.equals("y")){
            while (star.equals("y")){
                System.out.println("请出拳：1.剪刀 2.石头 3.布（输入相应数字）：");
                int s = input.nextInt();
                p.setA(s);
                int s1 = p.getA();
                int s2 = p.pchuquan(s1);
                int c2 = c.cchuquan();
                g.chuquan(s2,c2);
                cs++;//对战次数
                System.out.println("是否开始下一轮（y/n）");
                star = input.next();
            }
            System.out.println("--------------------------------");
            System.out.println(c.getName()+"   VS   "+p.getName());
            System.out.println("对战次数:"+ cs);
            System.out.println("--------------------------------");
            System.out.println("姓名"+"    "+"得分");
            System.out.println(p.getName()+"    "+g.count1);
            System.out.println(c.getName()+"    "+g.count2);
            if (g.count1>g.count2){
                System.out.println("结果: 恭喜恭喜");
            }else if (g.count1==g.count2){
                System.out.println("实力相当啊");
            }else {
                System.out.println("结果： 很遗憾，你输了");
            }
            System.out.println("要开始下一局吗？（y/n）");
            star = input.next();
        }
        System.out.println("系统退出！！！");
    }
}
